package com.alibaba.algo.cooperation.feign.service;

import com.alibaba.algo.cooperation.common.BaseResult;
import com.alibaba.algo.cooperation.common.PagerEntity;
import com.alibaba.algo.cooperation.feign.config.FeignConfiguration;
import com.alibaba.algo.cooperation.feign.vo.req.GetPositionDetailVo;
import com.alibaba.algo.cooperation.feign.vo.req.SelectPositionListByUserReqVO;
import com.alibaba.algo.cooperation.feign.vo.req.SelectPositionListRequestVO;
import com.alibaba.algo.cooperation.feign.vo.req.SelectPositionUserReqVO;
import com.alibaba.algo.cooperation.feign.vo.res.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author : WangZhiPan
 * @date : 2021/9/24 10:35
 */
@FeignClient(url="${feign.userCenterUrl:}", value = "usercenter-service", contextId = "usercenter-position", configuration = FeignConfiguration.class)
@Api(value = "岗位管理", tags = "岗位管理")
public interface PositionFeignService {


    /**
     * 根据组织查询岗位信息
     *
     * @param orgId 组织标识
     * @return 岗位列表
     */
    @ApiOperation(value = "根据组织查询岗位信息")
    @RequestMapping(value = "feignApi/userCenter/positions", method = RequestMethod.GET)
    BaseResult<List<SysPositionVO>> list(@RequestParam("orgId") Long orgId);

    /**
     * 获取岗位下的用户列表
     *
     * @param vo 岗位标识
     * @return 用户列表
     */
    @Deprecated
    @ApiOperation(value = "获取岗位下的用户列表",notes = "支持全量或有效查询，默认为全量")
    @RequestMapping(value = "feignApi/userCenter/positions/qryUserListByPositionId", method = RequestMethod.POST)
    BaseResult<List<PositionUserInfoResVO>> qryUserListByPositionId(@RequestBody SelectPositionUserReqVO vo);

    /**
     * 获取岗位详细
     *
     * @param vo 岗位编码或者id
     * @return 岗位详细信息
     */
    @ApiOperation(value = "获取岗位详细信息",notes = "支持全量或有效查询，默认为全量")
    @RequestMapping(value = "feignApi/userCenter/positionDetail", method = RequestMethod.POST)
    BaseResult<FeignPositionDetailVo> getPositionDetail(@RequestBody GetPositionDetailVo vo);

    /**
     * 根据用户信息获取岗位列表
     *
     * @param vo 用户信息
     * @return 角色列表
     */
    @RequestMapping(value = "feignApi/userCenter/positions/selectPositionListByUser", method = RequestMethod.POST)
    @ApiOperation(value = "根据用户信息获取岗位列表")
    BaseResult<PagerEntity<PositionInfoResponseVO>> selectPositionListByUser(@RequestBody SelectPositionListByUserReqVO vo);

    /**
     * 分页查询岗位列表
     * @param vo
     * @return
     */
    @RequestMapping(value = "feignApi/userCenter/positions/selectPage", method = RequestMethod.POST)
    @ApiOperation(value = "分页查询岗位列表")
    public BaseResult<PagerEntity<SelectPositionListResponseVO>> selectPage(@RequestBody SelectPositionListRequestVO vo);

    /**
     * 获取岗位下的用户列表
     *
     * @param vo 岗位标识
     * @return 用户列表
     */
    @ApiOperation(value = "获取岗位下的用户列表", notes = "仅支持有效数据查询")
    @RequestMapping(value = "feignApi/userCenter/positions/selectUserListByPosition", method = RequestMethod.POST)
    BaseResult<List<PositionUserInfoResVO>> selectUserListByPosition(@RequestBody SelectPositionUserReqVO vo);


    @ApiOperation(value = "获取岗位下的用户列表", notes = "支持全量或有效查询")
    @RequestMapping(value = "feignApi/userCenter/positions/selectUserListWithIsDeletedByPosition", method = RequestMethod.POST)
    BaseResult<List<PositionUserInfoResVO>> selectUserListWithIsDeletedByPosition(@RequestBody SelectPositionUserReqVO vo);

}
